﻿<?php 
if (!defined('WEB_ROOT')) {
	exit;
}

require_once 'functions.php';

$sql = getItemQuery($pcat, $pitem);
$result = dbQuery($sql);
$row = dbFetchAssoc($result);

$mapCol = array('bb'=>array('ten'=>'tenbb','tomtat'=>'tomtat_bb','noidung'=>'noidung_bb'),
				'dt'=>array('ten'=>'tendt','tomtat'=>'tomtat_dt','noidung'=>'noidung_dt'),
				'sm'=>array('ten'=>'chude','tomtat'=>'tomtat','noidung'=>'noidung'));
$tenCol = $mapCol[$pcat]['ten'];
$tomtatCol = $mapCol[$pcat]['tomtat'];
$noidungCol = $mapCol[$pcat]['noidung'];

$mapTableId = array('bb'=>TABLE_BAIBAO_ID, 'dt'=>TABLE_DETAI_ID, 'sm'=>TABLE_SEMINAR_ID);
$tableId = $mapTableId[$pcat];
$itemId = $row['id'];
?>
<script>
$(function() {
	var paginate = new virtualpaginate({
		 piececlass: "vp",
		 piececontainer: "p",
		 pieces_per_page: 2,
		 defaultpage: 0,
		 wraparound: false,
		 persist: true
		});
	paginate.buildpagination(["paginate1"]);
});
</script>
<div class="">
	<div id="articleBar">
		<div id="articleCat">
			<a href="index.php">Trang chủ</a>&nbsp;&nbsp;»&nbsp;&nbsp;<a href="javascript:viewList('<?php echo $pcat; ?>', '<?php echo $mapCat[$pcat]; ?>')"><?php echo $mapCat[$pcat]; ?></a>
		</div>
		<div id="articleTitle">
			<h1><?php echo $row[$tenCol]; ?></h1>
		</div>
	</div>
	<div class="frameContainer" style="height: auto;">
		<div id="articleFrame">
			<div class="byline">By JULIA PRESTON</div>
			<div class="dateline">June 4, 2011</div>
			<div class="articleColumn">
				<div id="content"> 
					<p><?php echo $row[$noidungCol]; ?></p>
				</div>
				<div class="clear" />
			</div>
			<<div class="pagination">
				<ul>
					<li><a href="#" id="prev" class="prevnext">« Previous</a></li>
					<li><a href="#" id="next" class="prevnext">Next »</a></li>
				</ul>
				<div id="page_number" class="page_number">1</div>
				</div>

		</div>
	</div>
	<div id="articleFooter">
		<!-- pass $tableId & $itemId to tag.php -->
		<?php require 'tag.php'; ?>
	</div>
</div>